﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiTextStyle : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiTextStyle(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiTextStyle obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiTextStyle()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiTextStyle(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public void setShapeLoaded(bool shapeLoaded)
		{
			GlobalsPINVOKE.OdGiTextStyle_setShapeLoaded(this.swigCPtr, shapeLoaded);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isShapeLoaded()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isShapeLoaded(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiTextStyle() : this(GlobalsPINVOKE.new_OdGiTextStyle(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void set(string fontName, string bigFontName, double textSize, double xScale, double obliquingAngle, double trackingPercent, bool isBackward, bool isUpsideDown, bool isVertical, bool isOverlined, bool isUnderlined)
		{
			GlobalsPINVOKE.OdGiTextStyle_set(this.swigCPtr, fontName, bigFontName, textSize, xScale, obliquingAngle, trackingPercent, isBackward, isUpsideDown, isVertical, isOverlined, isUnderlined);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void loadStyleRec(OdRxObject pDb)
		{
			GlobalsPINVOKE.OdGiTextStyle_loadStyleRec(this.swigCPtr, OdRxObject.getCPtr(pDb));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string getFontFilePath(OdRxObject pDb)
		{
			string result = GlobalsPINVOKE.OdGiTextStyle_getFontFilePath(this.swigCPtr, OdRxObject.getCPtr(pDb));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string getBigFontFilePath(OdRxObject pDb)
		{
			string result = GlobalsPINVOKE.OdGiTextStyle_getBigFontFilePath(this.swigCPtr, OdRxObject.getCPtr(pDb));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setFontFilePath(string fontFilePath)
		{
			GlobalsPINVOKE.OdGiTextStyle_setFontFilePath(this.swigCPtr, fontFilePath);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setBigFontFilePath(string bigFontFilePath)
		{
			GlobalsPINVOKE.OdGiTextStyle_setBigFontFilePath(this.swigCPtr, bigFontFilePath);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setTextSize(double textSize)
		{
			GlobalsPINVOKE.OdGiTextStyle_setTextSize(this.swigCPtr, textSize);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setXScale(double xScale)
		{
			GlobalsPINVOKE.OdGiTextStyle_setXScale(this.swigCPtr, xScale);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setObliquingAngle(double obliquingAngle)
		{
			GlobalsPINVOKE.OdGiTextStyle_setObliquingAngle(this.swigCPtr, obliquingAngle);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setTrackingPercent(double trackingPercent)
		{
			GlobalsPINVOKE.OdGiTextStyle_setTrackingPercent(this.swigCPtr, trackingPercent);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setBackward(bool isBackward)
		{
			GlobalsPINVOKE.OdGiTextStyle_setBackward(this.swigCPtr, isBackward);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setUpsideDown(bool isUpsideDown)
		{
			GlobalsPINVOKE.OdGiTextStyle_setUpsideDown(this.swigCPtr, isUpsideDown);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setVertical(bool isVertical)
		{
			GlobalsPINVOKE.OdGiTextStyle_setVertical(this.swigCPtr, isVertical);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setUnderlined(bool isUnderlined)
		{
			GlobalsPINVOKE.OdGiTextStyle_setUnderlined(this.swigCPtr, isUnderlined);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setOverlined(bool isOverlined)
		{
			GlobalsPINVOKE.OdGiTextStyle_setOverlined(this.swigCPtr, isOverlined);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setStriked(bool isStriked)
		{
			GlobalsPINVOKE.OdGiTextStyle_setStriked(this.swigCPtr, isStriked);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setPreLoaded(bool value)
		{
			GlobalsPINVOKE.OdGiTextStyle_setPreLoaded(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setShxFont(bool value)
		{
			GlobalsPINVOKE.OdGiTextStyle_setShxFont(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setFileName(string fontFileName)
		{
			GlobalsPINVOKE.OdGiTextStyle_setFileName(this.swigCPtr, fontFileName);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setBigFontFileName(string bigFontFileName)
		{
			GlobalsPINVOKE.OdGiTextStyle_setBigFontFileName(this.swigCPtr, bigFontFileName);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isBackward()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isBackward(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isUpsideDown()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isUpsideDown(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isVertical()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isVertical(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isUnderlined()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isUnderlined(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isOverlined()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isOverlined(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isStriked()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isStriked(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isPreLoaded()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isPreLoaded(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isShxFont()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isShxFont(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isTtfFont()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isTtfFont(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setIsShape(bool isShape)
		{
			GlobalsPINVOKE.OdGiTextStyle_setIsShape(this.swigCPtr, isShape);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isShape()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isShape(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setFont(string typeface, bool bold, bool italic, int charset, int pitchAndFamily)
		{
			GlobalsPINVOKE.OdGiTextStyle_setFont__SWIG_0(this.swigCPtr, typeface, bold, italic, charset, pitchAndFamily);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setFont(OdFont font)
		{
			GlobalsPINVOKE.OdGiTextStyle_setFont__SWIG_1(this.swigCPtr, OdFont.getCPtr(font));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setBigFont(OdFont pBigFont)
		{
			GlobalsPINVOKE.OdGiTextStyle_setBigFont(this.swigCPtr, OdFont.getCPtr(pBigFont));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void font(ref string typeface, out bool bold, out bool italic, out int charset, out int pitchAndFamily)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(typeface);
			IntPtr value = intPtr;
			try
			{
				GlobalsPINVOKE.OdGiTextStyle_font(this.swigCPtr, ref intPtr, out bold, out italic, out charset, out pitchAndFamily);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
			finally
			{
				if (intPtr != value)
				{
					typeface = Marshal.PtrToStringUni(intPtr);
				}
			}
		}

		public OdFont getFont()
		{
			OdFont result = (OdFont)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiTextStyle_getFont(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdFont getBigFont()
		{
			OdFont result = (OdFont)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiTextStyle_getBigFont(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdTtfDescriptor ttfdescriptor()
		{
			OdTtfDescriptor result = new OdTtfDescriptor(GlobalsPINVOKE.OdGiTextStyle_ttfdescriptor__SWIG_0(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public string bigFontFileName()
		{
			string result = GlobalsPINVOKE.OdGiTextStyle_bigFontFileName(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double textSize()
		{
			double result = GlobalsPINVOKE.OdGiTextStyle_textSize(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double xScale()
		{
			double result = GlobalsPINVOKE.OdGiTextStyle_xScale(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double obliquingAngle()
		{
			double result = GlobalsPINVOKE.OdGiTextStyle_obliquingAngle(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double trackingPercent()
		{
			double result = GlobalsPINVOKE.OdGiTextStyle_trackingPercent(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdCodePageId getCodePage()
		{
			OdCodePageId result = (OdCodePageId)GlobalsPINVOKE.OdGiTextStyle_getCodePage(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setCodePage(OdCodePageId codePage)
		{
			GlobalsPINVOKE.OdGiTextStyle_setCodePage(this.swigCPtr, (int)codePage);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string styleName()
		{
			string result = GlobalsPINVOKE.OdGiTextStyle_styleName(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setStyleName(string name)
		{
			GlobalsPINVOKE.OdGiTextStyle_setStyleName(this.swigCPtr, name);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setIsUseIntercharSpacing(bool isUseIntercharSpacing)
		{
			GlobalsPINVOKE.OdGiTextStyle_setIsUseIntercharSpacing(this.swigCPtr, isUseIntercharSpacing);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isUseIntercharSpacing()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isUseIntercharSpacing(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setIsFixedIntercharSpacing(bool isUseIntercharSpacing)
		{
			GlobalsPINVOKE.OdGiTextStyle_setIsFixedIntercharSpacing(this.swigCPtr, isUseIntercharSpacing);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool isFixedIntercharSpacing()
		{
			bool result = GlobalsPINVOKE.OdGiTextStyle_isFixedIntercharSpacing(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public double getIntercharSpacing()
		{
			double result = GlobalsPINVOKE.OdGiTextStyle_getIntercharSpacing(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setIntercharSpacing(double dSpacing)
		{
			GlobalsPINVOKE.OdGiTextStyle_setIntercharSpacing(this.swigCPtr, dSpacing);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public const int kShape = 1;

		public const int kUpsideDown = 2;

		public const int kVertical = 4;

		public const int kUnderlined = 8;

		public const int kOverlined = 16;

		public const int kShxFont = 32;

		public const int kPreLoaded = 64;

		public const int kBackward = 128;

		public const int kShapeLoaded = 256;

		public const int kStriked = 512;

		public const int kUseIntercharSpacing = 1024;

		public const int kFixedIntercharSpacing = 2048;

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
